import Vue from 'vue'
import App from './App.vue'
import router from './router.js'
import './plugins/element.js'
import axios from 'axios'
import './assets/css/global.css'
import TableTree from 'vue-table-with-tree-grid'
import qs from 'qs'

Vue.prototype.$http = axios

Vue.prototype.$qs = qs

Vue.component('tree-table', TableTree)

Vue.config.productionTip = false

axios.defaultCharset = 'UTF-8'

axios.defaults.baseURL = 'http://localhost:8888'

// 设置拦截器放token
axios.interceptors.request.use(config => {
  config.headers.token = window.sessionStorage.getItem('token')
  config.headers.loginAcct = window.sessionStorage.getItem('loginAcct')
  config.headers.dataType = 'json'
  console.log(config)
  return config
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
